package org.zachary.imitation.raft.option;

import org.zachary.imitation.raft.NodeImpl;

import java.util.concurrent.ScheduledExecutorService;

/**
 * 复制器组对象需要的配置参数对象
 */
public class ReplicatorGroupOptions {
	/** 当一个节点成为 Leader 后，经过这个时间之后，就要立刻向 Follower 发送心跳消息了 */
	private long heartbeatTimeoutMs;
	/** 超时选举的时间 */
	private long electionTimeoutMs;
	/** Leader 对应的节点对象 */
	private NodeImpl node;
	// private RaftClientService raftRpcClientService;
	/** raft 框架的全局配置参数 */
	private RaftOptions raftOptions;
	/** 心跳所需的基于 JDK 的定时任务 */
	private ScheduledExecutorService scheduledExecutorService;

	public long getHeartbeatTimeoutMs() {
		return heartbeatTimeoutMs;
	}

	public void setHeartbeatTimeoutMs(long heartbeatTimeoutMs) {
		this.heartbeatTimeoutMs = heartbeatTimeoutMs;
	}

	public long getElectionTimeoutMs() {
		return electionTimeoutMs;
	}

	public void setElectionTimeoutMs(long electionTimeoutMs) {
		this.electionTimeoutMs = electionTimeoutMs;
	}

	public NodeImpl getNode() {
		return node;
	}

	public void setNode(NodeImpl node) {
		this.node = node;
	}

	public RaftOptions getRaftOptions() {
		return raftOptions;
	}

	public void setRaftOptions(RaftOptions raftOptions) {
		this.raftOptions = raftOptions;
	}

	public ScheduledExecutorService getScheduledExecutorService() {
		return scheduledExecutorService;
	}

	public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService) {
		this.scheduledExecutorService = scheduledExecutorService;
	}

//	@Override
//	public String toString() {
//		return "ReplicatorGroupOptions{" + "heartbeatTimeoutMs=" + heartbeatTimeoutMs + ", electionTimeoutMs="
//				+ electionTimeoutMs + ",node=" + node
//				+ ",  raftRpcClientService=" + raftRpcClientService
//				+ ", raftOptions=" + raftOptions + ", scheduledExecutorService=" + scheduledExecutorService + '}';
//	}
}
